#pragma once
enum IOType { Read, Write };
#include <string>
#include "Parameters.h"

class ExtentIO
{

private:
   
	const double _time;		
	IOType _type;		
	int _lunID;			
	long _offset;
	long _realOffset;
	int _size;			
	bool _sequential;	
	bool _real;			// use for indication about pre-fetch to cahce.
	bool _isHit;
	bool _fromWrite;	// if true means that this eio came from write list -> needs to descrease dirtyBitcounter when it is removed from cache

	int round(double num);

public:
	int ExtentId;
	ExtentIO( double time, IOType type, int lunID, long offset, int size, bool real = true);
	virtual ~ExtentIO(void);
	ExtentIO( const ExtentIO&);
	// getters
	double getTime() const;
	IOType getType() const;
	int getLunID() const;
	long getOffset() const;
	long getRealOffset() const;
	
	int getSize(int align) const;
	int getSizeAligned(int align) const;

	double getSizeMB(double align) const;
	int getSizeBlocks() const;
	bool isSequential() const;
	bool isReal() const;
	bool isHit() const;
	bool isFromWrite();
	void setFromWrite();

	
	// setters
	void setSequential(bool b);
	void setOffset(long offset);
	void setReal(bool isReal);
	void setType(IOType type);
	void hit();
	// utility  

	std::string getIOID(int align) const;
	std::string getExtentEnd() const;
	std::string getExtentID() const;
};

